import http from '@/utils/request.js';

// 保养电梯状态
export const updateElevatorStatus = (data) => {
	// return http.post('/repairCheck/updateElevatorStatus',data,true)
	// return http.post('/repair/maintain/elevator/v2/update/',data,true);
	return http.request({
		url: '/repair/maintain/elevator/v2/update/',
		method: 'post',
		data,
		textJson: true,
	});
};
// 保养 电梯时间
export const updatePlanFinishTime = (data) => {
	// return http.post('/repairCheck/updatePlanFinishTime', data, true);
	return http.request({
		url: '/repairCheck/updatePlanFinishTime',
		method: 'post',
		data,
		textJson: true,
	});
};
// 保养 搜索部件
export const getPlanPart = (data) => {
	// return http.get('/repairCheck/getPlanPart', data);
	return http.request({
		url: '/repairCheck/getPlanPart',
		method: 'get',
		data,
	});
};

// 保养 任务详情
export const getPlanDetail = (data) => {
	// return http.get('/repairCheck/getPlanDetail', data);
	return http.request({
		url: '/repairCheck/getPlanDetail',
		method: 'get',
		data,
	});
};

// 保养 添加
export const addPlanCheckHistory = (data, autoid) => {
	// return http.post('/repairCheck/addPlanCheckHistory', data, true, true, autoid);
	return http.request({
		url: '/repairCheck/addPlanCheckHistory',
		method: 'post',
		data,
		textJson: true,
		toast: true,
		autoid
	});
};

// 保养 修改
export const updatePlanCheckHistory = (data) => {
	// return http.put('/repairCheck/updatePlanCheckHistory', data, true);
	return http.request({
		url: '/repairCheck/updatePlanCheckHistory',
		method: 'put',
		data,
		toast: true
	});
};

// 保养 删除
export const removePlanCheckHistory = (data) => {
	// return http.del('/repairCheck/removePlanCheckHistory', data);
	return http.request({
		url: '/repairCheck/removePlanCheckHistory',
		method: 'DELETE',
		data,
	});
};

// 保养 完成
export const accomplishCheck = (data) => {
	// return http.post('/repair/maintain/plan/content/update', data, true);
	return http.request({
		url: '/repair/maintain/plan/content/update',
		method: 'post',
		data,
		textJson: true,
	});
};
// 查看任务跟踪
export const repairLog = (data) => {
	// return http.get('/repair/maintain/malfunction/log/list', data);
	return http.request({
		url: '/repair/maintain/malfunction/log/list',
		method: 'get',
		data,
	});
};

// 网络重复请求
export const autoidID = (data) => {
	// return http.get('/autoid', data);
	return http.request({
		url: '/autoid',
		method: 'get',
		data,
	});
};
// 获取保养项
export const maintainDetail = (data) => {
	// return http.get('/repair/maintain/plan/content/detail', data);
	return http.request({
		url: '/repair/maintain/plan/content/detail',
		method: 'get',
		data,
	});
};
// 获取位置分类
export const location = (data) => {
	// return http.get('/template/location/type/list/plan', data);
	return http.request({
		url: '/template/location/type/list/plan',
		method: 'get',
		data,
	});
};
// 修改检查项状态
export const updateStatus = (data) => {
	// return http.put('/repair/maintain/check/history/update/status', data);
	return http.request({
		url: '/repair/maintain/check/history/update/status',
		method: 'put',
		data,
	});
};
// 签退
export const signOut = (data) => {
	// return http.post('/repair/maintain/sign/out', data, true);
	return http.request({
		url: '/repair/maintain/sign/out',
		method: 'post',
		data,
		textJson: true,
	});
};
// 添加作业记录
export const addRecord = (data) => {
	// return http.post('/repair/maintain/check/history/add/check/record', data, true);
	return http.request({
		url: '/repair/maintain/check/history/add/check/record',
		method: 'post',
		data,
		textJson: true,
	});
};
// 删除作业记录
export const delRecord = (data) => {
	// return http.del('/repair/maintain/check/history/delete/check/record', data);
	return http.request({
		url: '/repair/maintain/check/history/delete/check/record',
		method: 'DELETE',
		data,
	});
};
// 获取签到任务列表
// 
export const signRecord = (data) => {
	// return http.get('/repair/maintain/sign/list', data);
	return http.request({
		url: '/repair/maintain/sign/list',
		method: 'get',
		data,
	});
};
// 查询用户是否有保养中任务
export const checkUserOrder = (data) => {
	// return http.get('/repair/maintain/sign/plan/check', data);
	return http.request({
		url: '/repair/maintain/sign/plan/check',
		method: 'get',
		data,
	});
};
// 获取签到任务时间
// /repair/maintain/sign/user/detail
export const fetchSignTime = (data) => {
	// return http.get('/repair/maintain/sign/user/detail', data);
	return http.request({
		url: '/repair/maintain/sign/user/detail',
		method: 'get',
		data,
	});
};
// 是否最后一个签退
export const lastUser = (data) => {
	// return http.get('/repair/maintain/sign/check/last/user', data);
	return http.request({
		url: '/repair/maintain/sign/check/last/user',
		method: 'get',
		data,
	});
};

// 获取保养模板一级
export const elevatorType = (data) => {
	// return http.get('/repair/maintain/plan/content/template/elevator/type', data);
	return http.request({
		url: '/repair/maintain/plan/content/template/elevator/type',
		method: 'get',
		data,
	});
};
// 获取保养模板二级
export const contentTemp = (data) => {
	// return http.get('/repair/maintain/plan/content/template/v2', data);
	return http.request({
		url: '/repair/maintain/plan/content/template/v2',
		method: 'get',
		data,
	});
};

// 获取保养计划排期数据
export const calendarPlan = (data) => {
	// return http.post('/repair/maintain/plan/content/maintain/plan/calendar/data', data, true);
	return http.request({
		url: '/repair/maintain/plan/content/maintain/plan/calendar/data',
		method: 'post',
		data,
		textJson: true,
	});
};

// 获取保养计划排期下载
export const calendarPlanExcel = (data) => {
	// return http.post('/repair/maintain/plan/content/getDatePlanInfoList/down/excel', data, true);
	return http.request({
		url: '/repair/maintain/plan/content/getDatePlanInfoList/down/excel',
		method: 'post',
		data,
		textJson: true,
	});
};

// 保养计划日历列表明细统计
export const calendarlistStatistics = (data) => {
	// return http.post('/repair/maintain/plan/content/plan/calendar/list/statistics', data, true);
	return http.request({
		url: '/repair/maintain/plan/content/plan/calendar/list/statistics',
		method: 'post',
		data,
		textJson: true,
	});
};
// 保养计划日历工单下载统计数
export const calendarStatisticsCount = (data) => {
	// return http.post('/repair/maintain/plan/content/getDatePlanInfoList/down/statistics', data, true);
	return http.request({
		url: '/repair/maintain/plan/content/getDatePlanInfoList/down/statistics',
		method: 'post',
		data,
		textJson: true,
	});
};
